<script setup lang="ts">
import { computed } from "vue";

const props = withDefaults(
  defineProps<{
    status: number;
    statusMap?: Record<any, any>;
  }>(),
  {
    statusMap: () => ({
      "-1": {
        text: "冻结",
        type: "warning"
      },
      1: {
        text: "启用",
        type: "success"
      },
      2: {
        text: "未知",
        type: "info"
      }
    })
  }
);

const type = computed(() => {
  return (props.statusMap[props.status] || {}).type || "info";
});

const text = computed(() => {
  return (props.statusMap[props.status] || {}).text || "未知";
});
</script>

<template>
  <el-tag :type="type">{{ text }}</el-tag>
</template>
<style lang="scss" scoped></style>
